﻿/*
Copyright © 2010 SectorPoint, Inc.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
using System;
using System.Configuration;

namespace SectorPoint.Net.Mail
{
	/// <summary>
	/// Configuration element used by the SectorPoint.Net.Mail.Pop3Client class.
	/// </summary>
	internal class Pop3Element : ConfigurationElement
	{
		/// <summary>
		/// Host name or IP address of the remote POP3 server.
		/// </summary>
		[ConfigurationProperty( "host", IsRequired = true )]
		public string Host
		{
			get
			{
				return (string)this["host"];
			}
			set
			{
				this["host"] = value;
			}
		}

		/// <summary>
		/// Port number of the remote POP3 server.
		/// </summary>
		[ConfigurationProperty( "port", IsRequired = true, DefaultValue = 110 )]
		[IntegerValidator( MinValue = 1, MaxValue = 65535 )]
		public int Port
		{
			get
			{
				return (int)this["port"];
			}
			set
			{
				this["port"] = value;
			}
		}

		/// <summary>
		/// User name to authenticate with.
		/// </summary>
		[ConfigurationProperty( "user" )]
		public string User
		{
			get
			{
				return (string)this["user"];
			}
			set
			{
				this["user"] = value;
			}
		}

		/// <summary>
		/// Password to authenticate with.
		/// </summary>
		[ConfigurationProperty( "password" )]
		public string Password
		{
			get
			{
				return (string)this["password"];
			}
			set
			{
				this["password"] = value;
			}
		}

		/// <summary>
		/// Password to authenticate with.
		/// </summary>
		[ConfigurationProperty( "useSsl", DefaultValue = false )]
		public bool UseSsl
		{
			get
			{
				return (bool)this["useSsl"];
			}
			set
			{
				this["useSsl"] = value;
			}
		}
	}
}
